﻿using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace OnlineEducation.Helpers
{
    public static class ModelStateHelper
    {

        public static string GetErrorMessages(this ModelStateDictionary modelState)
        {
            return string.Join(" <br /> ", modelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
        }
    }
}
